//
//  UserInforItem.m
//  CoolRollerSkating
//
//  Created by 谢伟康 on 15/11/11.
//  Copyright © 2015年 Coollang. All rights reserved.
//

#import "UserInforItem.h"
#import "NSString+Extension.h"
#import <DateTools/DateTools.h>


@implementation UserInforItem

// Specify default values for properties

+ (NSDictionary *)defaultPropertyValues
{
    return @{
             @"name": @"",
             @"location": @"",
             @"genderType": @0,
             @"height": @"170",
             @"weight": @"60",
             @"birth": @"1995-01-01",
             @"signature": @"智能运动，引领时尚",
             @"headIconPath": @"",
             @"phoneNum": @"",
             @"userID": @"",
             @"creatTime": [NSDate date],
             @"lasLoginTime": @"",
             @"lastLoginVersion": @"",
             @"hand":@1,
             @"raketBrand":@"",
             @"ballAge":@"0",
             @"startTennisYear":@"",
             @"tennisLevel":@""
             };
}

- (void)parseUserInfoDictionary:(NSDictionary *)dictionary
{
    self.userID = [NSString checkIfNullWithString:dictionary[@"UserID"]];                 // 用户名ID
    self.name = [NSString checkIfNullWithString:dictionary[@"UserName"]];            // 用户名昵称
    self.genderType = ([[NSString checkIfNullWithString:dictionary[@"Sex"]] isEqualToString:@"1"]) ? GenderTypeMale : GenderTypeFemale;                      // 1表示男，0表示女
    
    if ([[NSString checkIfNullWithString:dictionary[@"Birthday"]] isEqualToString:@""]) {
        self.birth = @"1995-01-01";
    } else {
        self.birth = dictionary[@"Birthday"];
    }                                               // 生日
    
    
    if ([[NSString checkIfNullWithString:dictionary[@"Height"]] isEqualToString:@""]) {
        self.height = @"170";
    } else {
        self.height = dictionary[@"Height"];                // 身高
    }
    
    if ([[NSString checkIfNullWithString:dictionary[@"Weight"]] isEqualToString:@""]) {
        self.weight = @"60";
    } else {
        self.weight = dictionary[@"Weight"];                // 体重
    }
    
    self.location = [NSString checkIfNullWithString:dictionary[@"Address"]];             // 地址
    
    self.headIconPath = [NSString checkIfNullWithString:dictionary[@"Icon"]];            // 头像url
    
    self.signature = [NSString checkIfNullWithString:dictionary[@"Signature"]];          // 个人签名
    
    self.phoneNum = [NSString checkIfNullWithString:dictionary[@"Phone"]]; // 电话或者手机
    
    self.creatTime = [NSDate dateWithString:[NSString checkIfNullWithString:dictionary[@"CreateTime"]] formatString:@"yyyy-MM-dd"] ;         // 账号创建时间
    self.lasLoginTime = [NSString checkIfNullWithString:dictionary[@"LastLoginTime"]];   // 上次登陆时间
    self.lastLoginVersion = [NSString checkIfNullWithString:dictionary[@"LastLoginVersion"]];    // 上次登陆版本号
    self.email = [NSString checkIfNullWithString:dictionary[@"Email"]];
    self.hand = [[NSString checkIfNullWithString:dictionary[@"Hand"]] integerValue];
    self.raketBrand = [NSString checkIfNullWithString:dictionary[@"Brand"]];
    self.ballAge = [NSString checkIfNullWithString:dictionary[@"SportAge"]];
    self.startTennisYear = [NSString checkIfNullWithString:dictionary[@"StartTennisYear"]];
    self.tennisLevel = [NSString checkIfNullWithString:dictionary[@"Level"]];
    
}


@end
